﻿namespace question5
{
    public class Rect
    {
        public double Width { get; set; }
        public double Height { get; set; }
        public Rect(double width, double height)
        {
            Width = width;
            Height = height;
        }
        public Rect() : this(10, 10)
        {
        }
        public double Area()
        {
            return Width * Height;
        }
        public double Perimeter()
        {
            return 2 * (Width + Height);
        }
    }
    public class PlainRect : Rect
    {
        public double StartX { get; set; }
        public double StartY { get; set; }

        public PlainRect(double startX, double startY, double width, double height)
            : base(width, height)
        {
            StartX = startX;
            StartY = startY;
        }
        public PlainRect() : this(0, 0, 0, 0)
        {
        }
        public bool IsInside(double x, double y)
        {
            return x >= StartX && x <= StartX + Width &&
                   y >= StartY - Height && y <= StartY;
        }
    }
    public class Program
    {
        public static void Main()
        {
            PlainRect rect = new PlainRect(10, 10, 20, 10);
            Console.WriteLine($"矩形的面积: {rect.Area()}");
            Console.WriteLine($"矩形的周长: {rect.Perimeter()}");
            double x = 25.5;
            double y = 13;
            bool isInside = rect.IsInside(x, y);
            if (isInside)
            {
                Console.WriteLine($"点({x}, {y})在矩形内");
            }
            else
            {
                Console.WriteLine($"点({x}, {y})不在矩形内");
            }
        }
    }
}
